<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\model\relation\BelongsTo;

/**
 * @mixin Model
 */
class UserWechatSubscribeConfig extends BaseModel
{
    // 设置当前模型对应的数据表
    protected $name = 'user_wechat_subscribe_config';

    protected $json = ['subscribe_config'];

    const STATUS_ON = 'on';
    const STATUS_OFF = 'off';

    /**
     * 关联用户
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    /**
     * 关联小程序
     * @return BelongsTo
     */
    public function applet(): BelongsTo
    {
        return $this->belongsTo(Applet::class, 'applet_id');
    }
}
